//2009/08/31 01:58:09
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class DifferentStrings
{
public:
    int minimize(string A, string B)
    {
        int mmin = A.size();
        for (int i=0; i<B.size(); i++)
        {
            int diff = A.size();
            if (i + A.size() <= B.size())
            {
                for (int j=0; j<A.size() && i+j<B.size(); j++)
                    if (B[i+j] == A[j])
                        diff --;
            }
            mmin = min(mmin, diff);
        }
        return mmin;
    }
};
